<%@page import="com.wowangz.cms.common.utils.SysConstant.CommonUsedStatus"%>
<%@page import="com.wowangz.cms.common.utils.SysConstant.Templatetype"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/pageHead.jsp"%>
<script type="text/javascript">
	function view(val){
		var id = val;
		$(this).isswindow({
			noheader : true,
			url :"${systemctx}/systemmanage/sms/smsQuery/smsQueryView.web?id="+id
		});
	}
	
	function query_datagrid(){
		//加载分页控件 datagrid
		$('#datagrid').issdatagrid({
			formid : 'form1',
			title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.sms.query.list.title")%>',
			singleSelect : true,
			striped : true,
			url : '${systemctx}/systemmanage/sms/smsQuery/smsQueryList.json',
			sortName: 'modifytime',
			sortOrder: 'desc',
			remoteSort : true,
			idField : 'id',
			rownumbers : true,
			queryParams:$('#form1').serializeObject(),
			frozenColumns :[[
 				{title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.sms.query.column.telephone")%>',field : 'telephone',sortable : true,width:200,align : 'left',formatter: function(value,row,index){
 					 	  return "<a href=\"javascript:void(0);\" onclick=\"view('"+row.id+"')\">"+value+"</a>";
 					  }
 				},  
 				{title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.sms.query.column.smscontent")%>',field : 'smscontent',sortable : true,align : 'left',width:500},
 				{title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.query.sendtime")%>',field : 'inputtime',sortable : true,align : 'left',width:200}, 
 			]],
 			columns : [[  
              	{title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.sms.query.column.sendstatus")%>',field : 'sendstatusname',sortable : true,align : 'left',width:120} 
            ]],
			onLoadSuccess : function(data) {

			}
		});
	}
	$(document).ready(function() {
		$("#createtimefrom").date_input();
		$("#createtimeto").date_input();
		query_datagrid();
		$('#butQuery').click(function() {
			var startapplydate = $("#createtimefrom").val();
			var endapplydate = $("#createtimeto").val();
			var flag = duibi(startapplydate,endapplydate);
			if(flag == true) {
				$('#datagrid').datagrid('load',$('#form1').serializeObject());
			}
		});
		$("#sendstatus").selectutil({
			optModel :<%=SysConstant.Sendstatus.getModelJSONString(true, false)%>,
			optDefault :''
		});
	});
	function duibi(a, b) {
	 	var arr = a.split("-");
	    var starttime = new Date(arr[0], arr[1], arr[2]);
	    var starttimes = starttime.getTime();
	    var arrs = b.split("-");
	    var lktime = new Date(arrs[0], arrs[1], arrs[2]);
	    var lktimes = lktime.getTime();
	    if (starttimes >= lktimes) {
	        alert('<%=MessageResourcesUtils.getMessage(request, "systemmanage.query.alert1")%>');
	        return false;
	    } else
	        return true;
	}
</script>
<form action="" id="form1" name="form1">
	<div class="pageMain">
		<div class="pageTitle">
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title")%>
			<span></span>
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.sms.query.title") %>
			<span></span>
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.sms.query.list.title")%>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i> 
						<label>
							<%=MessageResourcesUtils.getMessage(request, "systemmanage.sms.query.column.telephone") %>
						</label>
						<span>
							<input type="text" name="telephone" id="telephone">
						</span>
					</li>
					<li>
						<i></i>
						<label>
							<%=MessageResourcesUtils.getMessage(request, "systemmanage.sms.query.column.sendstatus") %>
						</label>
						<span>
							<select name="sendstatus" id="sendstatus"></select>
						</span>
					</li>
				</ul>
				<ul>
					<li>
						<i></i> 
						<label>
							<%=MessageResourcesUtils.getMessage(request, "systemmanage.query.sendtime") %>&nbsp;&nbsp;
							<%=MessageResourcesUtils.getMessage(request, "systemmanage.query.starttime") %>
						</label>
						<span>
							<input type="text" value="${starttime }" name="createtimefrom" id="createtimefrom">
						</span>
					</li>
					<li>
						<i></i>
						<label>
							<%=MessageResourcesUtils.getMessage(request, "systemmanage.query.endtime") %>
						</label>
						<span>
							<input type="text" value="${endtime}" name="createtimeto" id="createtimeto">
						</span>
					</li>
				</ul>
			</div>
		</div>
		<div class="button-group">
			<input type="button" class="btn btn-default" id="butQuery" value="<%=MessageResourcesUtils.getMessage(request,"common.button.query") %>" />
		</div>
		<table style="width: 100%">
			<tr>
				<td>
					<table id="datagrid"></table>
				</td>
			</tr>
		</table>				
	</div>
</form>

<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>